--
-- PostgreSQL database dump
--

-- Started on 2010-06-20 18:44:29

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

--
-- TOC entry 334 (class 2612 OID 16386)
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
--

CREATE PROCEDURAL LANGUAGE plpgsql;


ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres;

SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- TOC entry 1521 (class 1259 OID 28957)
-- Dependencies: 6
-- Name: candidato; Type: TABLE; Schema: public; Owner: sivoe; Tablespace: 
--

CREATE TABLE candidato (
    nombre character varying(20) NOT NULL,
    apellido character varying(20) NOT NULL,
    fecha_de_nacimiento date NOT NULL,
    foto character varying(45) NOT NULL,
    edad integer NOT NULL,
    estado_civil character varying(20) NOT NULL,
    dir_residencia character varying(45),
    tel_residencia character varying(10),
    cedula character varying(10) NOT NULL,
    tel_oficina character varying(10),
    sexo character varying(1) NOT NULL,
    dir_oficina character varying(45),
    profesion character varying(30),
    llave integer NOT NULL,
    huella character varying(10) NOT NULL
);


ALTER TABLE public.candidato OWNER TO sivoe;

--
-- TOC entry 1522 (class 1259 OID 28960)
-- Dependencies: 1521 6
-- Name: candidato_llave_seq; Type: SEQUENCE; Schema: public; Owner: sivoe
--

CREATE SEQUENCE candidato_llave_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.candidato_llave_seq OWNER TO sivoe;

--
-- TOC entry 1880 (class 0 OID 0)
-- Dependencies: 1522
-- Name: candidato_llave_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: sivoe
--

ALTER SEQUENCE candidato_llave_seq OWNED BY candidato.llave;


--
-- TOC entry 1881 (class 0 OID 0)
-- Dependencies: 1522
-- Name: candidato_llave_seq; Type: SEQUENCE SET; Schema: public; Owner: sivoe
--

SELECT pg_catalog.setval('candidato_llave_seq', 25, true);


--
-- TOC entry 1523 (class 1259 OID 28962)
-- Dependencies: 6
-- Name: candidato_partido; Type: TABLE; Schema: public; Owner: sivoe; Tablespace: 
--

CREATE TABLE candidato_partido (
    candidato character varying(45) NOT NULL,
    llave_corporacion integer NOT NULL
);


ALTER TABLE public.candidato_partido OWNER TO sivoe;

--
-- TOC entry 1524 (class 1259 OID 28965)
-- Dependencies: 1523 6
-- Name: candidato_partido_llave_corporacion_seq; Type: SEQUENCE; Schema: public; Owner: sivoe
--

CREATE SEQUENCE candidato_partido_llave_corporacion_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.candidato_partido_llave_corporacion_seq OWNER TO sivoe;

--
-- TOC entry 1882 (class 0 OID 0)
-- Dependencies: 1524
-- Name: candidato_partido_llave_corporacion_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: sivoe
--

ALTER SEQUENCE candidato_partido_llave_corporacion_seq OWNED BY candidato_partido.llave_corporacion;


--
-- TOC entry 1883 (class 0 OID 0)
-- Dependencies: 1524
-- Name: candidato_partido_llave_corporacion_seq; Type: SEQUENCE SET; Schema: public; Owner: sivoe
--

SELECT pg_catalog.setval('candidato_partido_llave_corporacion_seq', 1, false);


--
-- TOC entry 1525 (class 1259 OID 28967)
-- Dependencies: 6
-- Name: consulta_partido; Type: TABLE; Schema: public; Owner: sivoe; Tablespace: 
--

CREATE TABLE consulta_partido (
    nombre_partido character varying(30) NOT NULL,
    llave integer NOT NULL
);


ALTER TABLE public.consulta_partido OWNER TO sivoe;

--
-- TOC entry 1526 (class 1259 OID 28970)
-- Dependencies: 6 1525
-- Name: consulta_partido_llave_seq; Type: SEQUENCE; Schema: public; Owner: sivoe
--

CREATE SEQUENCE consulta_partido_llave_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.consulta_partido_llave_seq OWNER TO sivoe;

--
-- TOC entry 1884 (class 0 OID 0)
-- Dependencies: 1526
-- Name: consulta_partido_llave_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: sivoe
--

ALTER SEQUENCE consulta_partido_llave_seq OWNED BY consulta_partido.llave;


--
-- TOC entry 1885 (class 0 OID 0)
-- Dependencies: 1526
-- Name: consulta_partido_llave_seq; Type: SEQUENCE SET; Schema: public; Owner: sivoe
--

SELECT pg_catalog.setval('consulta_partido_llave_seq', 1, false);


--
-- TOC entry 1527 (class 1259 OID 28972)
-- Dependencies: 6
-- Name: corporacion; Type: TABLE; Schema: public; Owner: sivoe; Tablespace: 
--

CREATE TABLE corporacion (
    nombre character varying(30) NOT NULL,
    descripcion character varying(100) NOT NULL,
    llave integer NOT NULL
);


ALTER TABLE public.corporacion OWNER TO sivoe;

--
-- TOC entry 1528 (class 1259 OID 28975)
-- Dependencies: 1527 6
-- Name: corporacion_llave_seq; Type: SEQUENCE; Schema: public; Owner: sivoe
--

CREATE SEQUENCE corporacion_llave_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.corporacion_llave_seq OWNER TO sivoe;

--
-- TOC entry 1886 (class 0 OID 0)
-- Dependencies: 1528
-- Name: corporacion_llave_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: sivoe
--

ALTER SEQUENCE corporacion_llave_seq OWNED BY corporacion.llave;


--
-- TOC entry 1887 (class 0 OID 0)
-- Dependencies: 1528
-- Name: corporacion_llave_seq; Type: SEQUENCE SET; Schema: public; Owner: sivoe
--

SELECT pg_catalog.setval('corporacion_llave_seq', 5, true);


--
-- TOC entry 1529 (class 1259 OID 28977)
-- Dependencies: 6
-- Name: departamento; Type: TABLE; Schema: public; Owner: sivoe; Tablespace: 
--

CREATE TABLE departamento (
    cod_depto integer NOT NULL,
    departamento character varying(45) NOT NULL
);


ALTER TABLE public.departamento OWNER TO sivoe;

--
-- TOC entry 1530 (class 1259 OID 28980)
-- Dependencies: 6
-- Name: jornada; Type: TABLE; Schema: public; Owner: sivoe; Tablespace: 
--

CREATE TABLE jornada (
    fecha_finalizacion timestamp without time zone NOT NULL,
    fecha_inicio timestamp without time zone NOT NULL,
    tipo character varying(11),
    codigo_jornada integer NOT NULL
);


ALTER TABLE public.jornada OWNER TO sivoe;

--
-- TOC entry 1531 (class 1259 OID 28983)
-- Dependencies: 6 1530
-- Name: jornada_codigo_jornada_seq; Type: SEQUENCE; Schema: public; Owner: sivoe
--

CREATE SEQUENCE jornada_codigo_jornada_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.jornada_codigo_jornada_seq OWNER TO sivoe;

--
-- TOC entry 1888 (class 0 OID 0)
-- Dependencies: 1531
-- Name: jornada_codigo_jornada_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: sivoe
--

ALTER SEQUENCE jornada_codigo_jornada_seq OWNED BY jornada.codigo_jornada;


--
-- TOC entry 1889 (class 0 OID 0)
-- Dependencies: 1531
-- Name: jornada_codigo_jornada_seq; Type: SEQUENCE SET; Schema: public; Owner: sivoe
--

SELECT pg_catalog.setval('jornada_codigo_jornada_seq', 17, true);


--
-- TOC entry 1532 (class 1259 OID 28985)
-- Dependencies: 6
-- Name: jornada_corporacion; Type: TABLE; Schema: public; Owner: sivoe; Tablespace: 
--

CREATE TABLE jornada_corporacion (
    llave_corp integer NOT NULL,
    llave_jorn integer NOT NULL
);


ALTER TABLE public.jornada_corporacion OWNER TO sivoe;

--
-- TOC entry 1533 (class 1259 OID 28988)
-- Dependencies: 6
-- Name: partido; Type: TABLE; Schema: public; Owner: sivoe; Tablespace: 
--

CREATE TABLE partido (
    nombre character varying(50) NOT NULL,
    ideologia character varying(100) NOT NULL,
    logotipo text NOT NULL,
    datos_adicionales character varying(100) NOT NULL,
    llave integer NOT NULL
);


ALTER TABLE public.partido OWNER TO sivoe;

--
-- TOC entry 1534 (class 1259 OID 28994)
-- Dependencies: 1533 6
-- Name: partido_llave_seq; Type: SEQUENCE; Schema: public; Owner: sivoe
--

CREATE SEQUENCE partido_llave_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.partido_llave_seq OWNER TO sivoe;

--
-- TOC entry 1890 (class 0 OID 0)
-- Dependencies: 1534
-- Name: partido_llave_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: sivoe
--

ALTER SEQUENCE partido_llave_seq OWNED BY partido.llave;


--
-- TOC entry 1891 (class 0 OID 0)
-- Dependencies: 1534
-- Name: partido_llave_seq; Type: SEQUENCE SET; Schema: public; Owner: sivoe
--

SELECT pg_catalog.setval('partido_llave_seq', 4, true);


--
-- TOC entry 1535 (class 1259 OID 28996)
-- Dependencies: 6
-- Name: perfil; Type: TABLE; Schema: public; Owner: sivoe; Tablespace: 
--

CREATE TABLE perfil (
    cod_perfil integer NOT NULL,
    perfil character varying(45) NOT NULL
);


ALTER TABLE public.perfil OWNER TO sivoe;

--
-- TOC entry 1536 (class 1259 OID 28999)
-- Dependencies: 6
-- Name: sufragante_ya_voto; Type: TABLE; Schema: public; Owner: sivoe; Tablespace: 
--

CREATE TABLE sufragante_ya_voto (
    llave_sufragante integer NOT NULL,
    llave_corporacion integer NOT NULL
);


ALTER TABLE public.sufragante_ya_voto OWNER TO sivoe;

--
-- TOC entry 1537 (class 1259 OID 29002)
-- Dependencies: 6
-- Name: usuario; Type: TABLE; Schema: public; Owner: sivoe; Tablespace: 
--

CREATE TABLE usuario (
    login character varying(20) NOT NULL,
    password character varying(30) NOT NULL,
    nombre character varying(45) NOT NULL,
    apellido character varying(45) NOT NULL,
    cedula character varying(10) NOT NULL,
    cod_perfil integer NOT NULL,
    llave integer NOT NULL,
    sexo character varying(1) NOT NULL,
    cod_depto integer NOT NULL
);


ALTER TABLE public.usuario OWNER TO sivoe;

--
-- TOC entry 1538 (class 1259 OID 29005)
-- Dependencies: 6 1537
-- Name: usuario_llave_seq; Type: SEQUENCE; Schema: public; Owner: sivoe
--

CREATE SEQUENCE usuario_llave_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.usuario_llave_seq OWNER TO sivoe;

--
-- TOC entry 1892 (class 0 OID 0)
-- Dependencies: 1538
-- Name: usuario_llave_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: sivoe
--

ALTER SEQUENCE usuario_llave_seq OWNED BY usuario.llave;


--
-- TOC entry 1893 (class 0 OID 0)
-- Dependencies: 1538
-- Name: usuario_llave_seq; Type: SEQUENCE SET; Schema: public; Owner: sivoe
--

SELECT pg_catalog.setval('usuario_llave_seq', 4, true);


--
-- TOC entry 1539 (class 1259 OID 29007)
-- Dependencies: 1824 1825 6
-- Name: votacion; Type: TABLE; Schema: public; Owner: sivoe; Tablespace: 
--

CREATE TABLE votacion (
    llave_jornada integer NOT NULL,
    llave_corporacion integer NOT NULL,
    llave_candidato integer NOT NULL,
    llave_partido integer NOT NULL,
    cant_votos integer DEFAULT 0 NOT NULL,
    num_candidato integer DEFAULT 0 NOT NULL,
    llave_depto integer NOT NULL
);


ALTER TABLE public.votacion OWNER TO sivoe;

--
-- TOC entry 1817 (class 2604 OID 29012)
-- Dependencies: 1522 1521
-- Name: llave; Type: DEFAULT; Schema: public; Owner: sivoe
--

ALTER TABLE candidato ALTER COLUMN llave SET DEFAULT nextval('candidato_llave_seq'::regclass);


--
-- TOC entry 1818 (class 2604 OID 29013)
-- Dependencies: 1524 1523
-- Name: llave_corporacion; Type: DEFAULT; Schema: public; Owner: sivoe
--

ALTER TABLE candidato_partido ALTER COLUMN llave_corporacion SET DEFAULT nextval('candidato_partido_llave_corporacion_seq'::regclass);


--
-- TOC entry 1819 (class 2604 OID 29014)
-- Dependencies: 1526 1525
-- Name: llave; Type: DEFAULT; Schema: public; Owner: sivoe
--

ALTER TABLE consulta_partido ALTER COLUMN llave SET DEFAULT nextval('consulta_partido_llave_seq'::regclass);


--
-- TOC entry 1820 (class 2604 OID 29015)
-- Dependencies: 1528 1527
-- Name: llave; Type: DEFAULT; Schema: public; Owner: sivoe
--

ALTER TABLE corporacion ALTER COLUMN llave SET DEFAULT nextval('corporacion_llave_seq'::regclass);


--
-- TOC entry 1821 (class 2604 OID 29016)
-- Dependencies: 1531 1530
-- Name: codigo_jornada; Type: DEFAULT; Schema: public; Owner: sivoe
--

ALTER TABLE jornada ALTER COLUMN codigo_jornada SET DEFAULT nextval('jornada_codigo_jornada_seq'::regclass);


--
-- TOC entry 1822 (class 2604 OID 29017)
-- Dependencies: 1534 1533
-- Name: llave; Type: DEFAULT; Schema: public; Owner: sivoe
--

ALTER TABLE partido ALTER COLUMN llave SET DEFAULT nextval('partido_llave_seq'::regclass);


--
-- TOC entry 1823 (class 2604 OID 29018)
-- Dependencies: 1538 1537
-- Name: llave; Type: DEFAULT; Schema: public; Owner: sivoe
--

ALTER TABLE usuario ALTER COLUMN llave SET DEFAULT nextval('usuario_llave_seq'::regclass);


--
-- TOC entry 1863 (class 0 OID 28957)
-- Dependencies: 1521
-- Data for Name: candidato; Type: TABLE DATA; Schema: public; Owner: sivoe
--

COPY candidato (nombre, apellido, fecha_de_nacimiento, foto, edad, estado_civil, dir_residencia, tel_residencia, cedula, tel_oficina, sexo, dir_oficina, profesion, llave, huella) FROM stdin;
Alexander	Mesa 	1988-11-28	Funcional.java	22	casado	cll 11 # 59-07	3967772	1142589630	3318452	M	cra 24 # 32 -56	Politico	3	1142589630
elver	gomez	2010-07-19	imagenesTarjeton/1152824314.jpg	24	viudo	\N	\N	1152824314	\N	M	\N	\N	16	12e12
pamela	shu	2010-07-19	imagenesTarjeton/1152824326.jpg	30	viudo	\N	\N	1152824326	\N	M	\N	\N	17	12d12
elver	gomez	2010-07-19	imagenesTarjeton/1152824326.jpg	60	viudo	\N	\N	1152824327	\N	M	\N	\N	18	a1212
elver	gomez	2010-07-19	imagenesTarjeton/1152824314.jpg	24	viudo	\N	\N	1152824314	\N	M	\N	\N	19	12e12
pamela	shu	2010-07-19	imagenesTarjeton/1152824326.jpg	30	viudo	\N	\N	1152824326	\N	M	\N	\N	20	12d12
elver	gomez	2010-07-19	imagenesTarjeton/1152824326.jpg	60	viudo	\N	\N	1152824327	\N	M	\N	\N	21	a1212
Pamela	Chu	1958-11-15		52	libre	lamfska	45786	1144587421	52164616	F	dfhdfh	Oficios varios	22	1144587421
Pamela	Chu	1953-10-08	imagenesTarjeton/145872314.java	57	libre	afsgsdg	437563763	145872314	746373685	F	fgsdg	Oficios varios	23	145872314
mmmmmmm	nnnnnnnnn	1953-09-16	imagenesTarjeton/4532786378.ppt	57	casado	vfhjdg	5735378	4532786378	7863786	F	asdgeh	<zfasfwgqe	24	4532786378
aja	bueno	1950-07-06	imagenesTarjeton/1144043031.ppt	60	soltero	dsadg	853786	1144043031	768876	F	sgasdg	wfqewtwe	25	1144043031
\.


--
-- TOC entry 1864 (class 0 OID 28962)
-- Dependencies: 1523
-- Data for Name: candidato_partido; Type: TABLE DATA; Schema: public; Owner: sivoe
--

COPY candidato_partido (candidato, llave_corporacion) FROM stdin;
\.


--
-- TOC entry 1865 (class 0 OID 28967)
-- Dependencies: 1525
-- Data for Name: consulta_partido; Type: TABLE DATA; Schema: public; Owner: sivoe
--

COPY consulta_partido (nombre_partido, llave) FROM stdin;
\.


--
-- TOC entry 1866 (class 0 OID 28972)
-- Dependencies: 1527
-- Data for Name: corporacion; Type: TABLE DATA; Schema: public; Owner: sivoe
--

COPY corporacion (nombre, descripcion, llave) FROM stdin;
Alcaldia	La de las ciudades	1
Gobernacion	La de los departamentos	2
Presidencia	La del pais	3
Senado	Una parte del congreso	4
Camara de representantes	La otra parte del congreso que tiene representante por departamento	5
\.


--
-- TOC entry 1867 (class 0 OID 28977)
-- Dependencies: 1529
-- Data for Name: departamento; Type: TABLE DATA; Schema: public; Owner: sivoe
--

COPY departamento (cod_depto, departamento) FROM stdin;
1	Amazonas
2	Antioquia
3	Arauca
4	Atlantico
5	Bolivar
6	Boyaca
7	Caldas
8	Caqueta
9	Casanare
10	Cauca
11	Cesar
12	Choco
13	Cordoba
14	Cundinamarca
15	Guainia
16	Guaviare
17	Huila
18	Guajira
19	Magdalena
20	Meta
21	Narino
22	Norte de Santander
23	Putumayo
24	Quindio
25	Risaralda
26	San Andres Isla
27	Santander
28	Sucre
29	Tolima
30	Valle
31	Vaupes
32	Vichada
\.


--
-- TOC entry 1868 (class 0 OID 28980)
-- Dependencies: 1530
-- Data for Name: jornada; Type: TABLE DATA; Schema: public; Owner: sivoe
--

COPY jornada (fecha_finalizacion, fecha_inicio, tipo, codigo_jornada) FROM stdin;
2010-07-25 00:00:00	2010-06-25 00:00:00	inscripcion	1
2010-03-15 00:00:00	2010-03-25 00:00:00	inscripcion	3
2011-08-15 06:00:00	2010-07-14 03:04:00	inscripcion	4
2010-07-25 04:04:00	2010-06-15 00:00:00	votacion	6
2010-07-17 04:04:00	2010-05-25 00:00:00	inscripcion	2
2013-02-05 03:03:00	2010-06-14 03:04:00	votacion	8
2010-08-01 23:59:00	2010-07-01 00:00:00	votacion	9
2010-08-08 02:02:00	2010-04-08 00:00:00	votacion	15
\.


--
-- TOC entry 1869 (class 0 OID 28985)
-- Dependencies: 1532
-- Data for Name: jornada_corporacion; Type: TABLE DATA; Schema: public; Owner: sivoe
--

COPY jornada_corporacion (llave_corp, llave_jorn) FROM stdin;
4	8
5	8
4	15
5	15
\.


--
-- TOC entry 1870 (class 0 OID 28988)
-- Dependencies: 1533
-- Data for Name: partido; Type: TABLE DATA; Schema: public; Owner: sivoe
--

COPY partido (nombre, ideologia, logotipo, datos_adicionales, llave) FROM stdin;
Partido Liberal	-----------	imagenesTarjeton/Partido Liberal.ppt	...............	1
Cosa Loca	Representar la muestra poblacional del pais que se considera una "cosa loca"	imagenesTarjeton/Cosa Loca.jpg	Principal: Juliana Palacio Millan	2
Cosa Loca	Representar la muestra poblacional del pais que se considera una "cosa loca"	imagenesTarjeton/Cosa Loca.jpg	Principal: Juliana Palacio Millan	3
Cosa Loca	Representar la muestra poblacional del pais que se considera una "cosa loca"	imagenesTarjeton/Cosa Loca.jpg	Principal: Juliana Palacio Millan	4
\.


--
-- TOC entry 1871 (class 0 OID 28996)
-- Dependencies: 1535
-- Data for Name: perfil; Type: TABLE DATA; Schema: public; Owner: sivoe
--

COPY perfil (cod_perfil, perfil) FROM stdin;
1	Administrador
2	Funcionario
3	Sufragante
\.


--
-- TOC entry 1872 (class 0 OID 28999)
-- Dependencies: 1536
-- Data for Name: sufragante_ya_voto; Type: TABLE DATA; Schema: public; Owner: sivoe
--

COPY sufragante_ya_voto (llave_sufragante, llave_corporacion) FROM stdin;
\.


--
-- TOC entry 1873 (class 0 OID 29002)
-- Dependencies: 1537
-- Data for Name: usuario; Type: TABLE DATA; Schema: public; Owner: sivoe
--

COPY usuario (login, password, nombre, apellido, cedula, cod_perfil, llave, sexo, cod_depto) FROM stdin;
1130623925	ginacm	Gina N.	Ceron	1130623925	2	2	F	30
1151934314	oscaracc	Oscar	Chamat	1151934314	2	3	M	30
123	1	1	1	1	3	4	M	1
root	erika	Erika	Suarez	1144030800	1	1	F	30
\.


--
-- TOC entry 1874 (class 0 OID 29007)
-- Dependencies: 1539
-- Data for Name: votacion; Type: TABLE DATA; Schema: public; Owner: sivoe
--

COPY votacion (llave_jornada, llave_corporacion, llave_candidato, llave_partido, cant_votos, num_candidato, llave_depto) FROM stdin;
\.


--
-- TOC entry 1829 (class 2606 OID 29020)
-- Dependencies: 1523 1523
-- Name: candidato_partido_pkey; Type: CONSTRAINT; Schema: public; Owner: sivoe; Tablespace: 
--

ALTER TABLE ONLY candidato_partido
    ADD CONSTRAINT candidato_partido_pkey PRIMARY KEY (llave_corporacion);


--
-- TOC entry 1827 (class 2606 OID 29022)
-- Dependencies: 1521 1521
-- Name: candidato_pkey; Type: CONSTRAINT; Schema: public; Owner: sivoe; Tablespace: 
--

ALTER TABLE ONLY candidato
    ADD CONSTRAINT candidato_pkey PRIMARY KEY (llave);


--
-- TOC entry 1831 (class 2606 OID 29024)
-- Dependencies: 1525 1525
-- Name: consulta_partido_pkey; Type: CONSTRAINT; Schema: public; Owner: sivoe; Tablespace: 
--

ALTER TABLE ONLY consulta_partido
    ADD CONSTRAINT consulta_partido_pkey PRIMARY KEY (llave);


--
-- TOC entry 1833 (class 2606 OID 29026)
-- Dependencies: 1527 1527
-- Name: corporacion_pkey; Type: CONSTRAINT; Schema: public; Owner: sivoe; Tablespace: 
--

ALTER TABLE ONLY corporacion
    ADD CONSTRAINT corporacion_pkey PRIMARY KEY (llave);


--
-- TOC entry 1835 (class 2606 OID 29028)
-- Dependencies: 1529 1529
-- Name: departamento_pkey; Type: CONSTRAINT; Schema: public; Owner: sivoe; Tablespace: 
--

ALTER TABLE ONLY departamento
    ADD CONSTRAINT departamento_pkey PRIMARY KEY (cod_depto);


--
-- TOC entry 1839 (class 2606 OID 29030)
-- Dependencies: 1532 1532 1532
-- Name: jornada_corporacion_pkey; Type: CONSTRAINT; Schema: public; Owner: sivoe; Tablespace: 
--

ALTER TABLE ONLY jornada_corporacion
    ADD CONSTRAINT jornada_corporacion_pkey PRIMARY KEY (llave_corp, llave_jorn);


--
-- TOC entry 1837 (class 2606 OID 29032)
-- Dependencies: 1530 1530
-- Name: jornada_pkey; Type: CONSTRAINT; Schema: public; Owner: sivoe; Tablespace: 
--

ALTER TABLE ONLY jornada
    ADD CONSTRAINT jornada_pkey PRIMARY KEY (codigo_jornada);


--
-- TOC entry 1841 (class 2606 OID 29034)
-- Dependencies: 1533 1533
-- Name: partido_pkey; Type: CONSTRAINT; Schema: public; Owner: sivoe; Tablespace: 
--

ALTER TABLE ONLY partido
    ADD CONSTRAINT partido_pkey PRIMARY KEY (llave);


--
-- TOC entry 1843 (class 2606 OID 29036)
-- Dependencies: 1535 1535
-- Name: perfil_pkey; Type: CONSTRAINT; Schema: public; Owner: sivoe; Tablespace: 
--

ALTER TABLE ONLY perfil
    ADD CONSTRAINT perfil_pkey PRIMARY KEY (cod_perfil);


--
-- TOC entry 1845 (class 2606 OID 29038)
-- Dependencies: 1536 1536 1536
-- Name: sufragante_ya_voto_pkey; Type: CONSTRAINT; Schema: public; Owner: sivoe; Tablespace: 
--

ALTER TABLE ONLY sufragante_ya_voto
    ADD CONSTRAINT sufragante_ya_voto_pkey PRIMARY KEY (llave_sufragante, llave_corporacion);


--
-- TOC entry 1847 (class 2606 OID 29040)
-- Dependencies: 1537 1537
-- Name: usuario_cedula_key; Type: CONSTRAINT; Schema: public; Owner: sivoe; Tablespace: 
--

ALTER TABLE ONLY usuario
    ADD CONSTRAINT usuario_cedula_key UNIQUE (cedula);


--
-- TOC entry 1849 (class 2606 OID 29042)
-- Dependencies: 1537 1537
-- Name: usuario_pkey; Type: CONSTRAINT; Schema: public; Owner: sivoe; Tablespace: 
--

ALTER TABLE ONLY usuario
    ADD CONSTRAINT usuario_pkey PRIMARY KEY (llave);


--
-- TOC entry 1851 (class 2606 OID 29044)
-- Dependencies: 1539 1539 1539 1539 1539
-- Name: votacion_pkey; Type: CONSTRAINT; Schema: public; Owner: sivoe; Tablespace: 
--

ALTER TABLE ONLY votacion
    ADD CONSTRAINT votacion_pkey PRIMARY KEY (llave_jornada, llave_corporacion, llave_candidato, llave_partido);


--
-- TOC entry 1852 (class 2606 OID 29045)
-- Dependencies: 1527 1532 1832
-- Name: jornada_corporacion_llave_corp_fkey; Type: FK CONSTRAINT; Schema: public; Owner: sivoe
--

ALTER TABLE ONLY jornada_corporacion
    ADD CONSTRAINT jornada_corporacion_llave_corp_fkey FOREIGN KEY (llave_corp) REFERENCES corporacion(llave);


--
-- TOC entry 1853 (class 2606 OID 29050)
-- Dependencies: 1530 1532 1836
-- Name: jornada_corporacion_llave_jorn_fkey; Type: FK CONSTRAINT; Schema: public; Owner: sivoe
--

ALTER TABLE ONLY jornada_corporacion
    ADD CONSTRAINT jornada_corporacion_llave_jorn_fkey FOREIGN KEY (llave_jorn) REFERENCES jornada(codigo_jornada) ON DELETE CASCADE;


--
-- TOC entry 1854 (class 2606 OID 29055)
-- Dependencies: 1536 1527 1832
-- Name: sufragante_ya_voto_llave_corporacion_fkey; Type: FK CONSTRAINT; Schema: public; Owner: sivoe
--

ALTER TABLE ONLY sufragante_ya_voto
    ADD CONSTRAINT sufragante_ya_voto_llave_corporacion_fkey FOREIGN KEY (llave_corporacion) REFERENCES corporacion(llave);


--
-- TOC entry 1855 (class 2606 OID 29060)
-- Dependencies: 1848 1536 1537
-- Name: sufragante_ya_voto_llave_sufragante_fkey; Type: FK CONSTRAINT; Schema: public; Owner: sivoe
--

ALTER TABLE ONLY sufragante_ya_voto
    ADD CONSTRAINT sufragante_ya_voto_llave_sufragante_fkey FOREIGN KEY (llave_sufragante) REFERENCES usuario(llave);


--
-- TOC entry 1856 (class 2606 OID 29065)
-- Dependencies: 1537 1834 1529
-- Name: usuario_cod_depto_departamento_cod_depto; Type: FK CONSTRAINT; Schema: public; Owner: sivoe
--

ALTER TABLE ONLY usuario
    ADD CONSTRAINT usuario_cod_depto_departamento_cod_depto FOREIGN KEY (cod_depto) REFERENCES departamento(cod_depto);


--
-- TOC entry 1857 (class 2606 OID 29070)
-- Dependencies: 1537 1842 1535
-- Name: usuario_cod_perfil_perfil_cod_perfil; Type: FK CONSTRAINT; Schema: public; Owner: sivoe
--

ALTER TABLE ONLY usuario
    ADD CONSTRAINT usuario_cod_perfil_perfil_cod_perfil FOREIGN KEY (cod_perfil) REFERENCES perfil(cod_perfil);


--
-- TOC entry 1858 (class 2606 OID 29075)
-- Dependencies: 1539 1521 1826
-- Name: votacion_llave_candidato_candidato_llave; Type: FK CONSTRAINT; Schema: public; Owner: sivoe
--

ALTER TABLE ONLY votacion
    ADD CONSTRAINT votacion_llave_candidato_candidato_llave FOREIGN KEY (llave_candidato) REFERENCES candidato(llave) ON DELETE CASCADE;


--
-- TOC entry 1859 (class 2606 OID 29080)
-- Dependencies: 1539 1527 1832
-- Name: votacion_llave_corporacion_corporacion_llave; Type: FK CONSTRAINT; Schema: public; Owner: sivoe
--

ALTER TABLE ONLY votacion
    ADD CONSTRAINT votacion_llave_corporacion_corporacion_llave FOREIGN KEY (llave_corporacion) REFERENCES corporacion(llave) ON DELETE CASCADE;


--
-- TOC entry 1862 (class 2606 OID 29096)
-- Dependencies: 1539 1834 1529
-- Name: votacion_llave_depto_fkey; Type: FK CONSTRAINT; Schema: public; Owner: sivoe
--

ALTER TABLE ONLY votacion
    ADD CONSTRAINT votacion_llave_depto_fkey FOREIGN KEY (llave_depto) REFERENCES departamento(cod_depto);


--
-- TOC entry 1860 (class 2606 OID 29085)
-- Dependencies: 1539 1530 1836
-- Name: votacion_llave_jornada_jornada_codigo_jornada; Type: FK CONSTRAINT; Schema: public; Owner: sivoe
--

ALTER TABLE ONLY votacion
    ADD CONSTRAINT votacion_llave_jornada_jornada_codigo_jornada FOREIGN KEY (llave_jornada) REFERENCES jornada(codigo_jornada) ON DELETE CASCADE;


--
-- TOC entry 1861 (class 2606 OID 29090)
-- Dependencies: 1533 1539 1840
-- Name: votacion_llave_partido_partido_llave; Type: FK CONSTRAINT; Schema: public; Owner: sivoe
--

ALTER TABLE ONLY votacion
    ADD CONSTRAINT votacion_llave_partido_partido_llave FOREIGN KEY (llave_partido) REFERENCES partido(llave) ON DELETE CASCADE;


--
-- TOC entry 1879 (class 0 OID 0)
-- Dependencies: 6
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;


-- Completed on 2010-06-20 18:44:29

--
-- PostgreSQL database dump complete
--

